
local mt = ac.skill['捕捉']
mt.targettype = '点'
mt.range = 1500
mt.missile_art = [[Abilities\Spells\Orc\Ensnare\EnsnareMissile.mdl]]

function mt:on_cast_shot()
    local hero = self.owner
    local target = self.target
    local point = hero:get_point()
    local angle = point / target:get_point()
    hero:add_restriction '硬直'
    hero:add_effect([[9753276ca38a709ee315c35f23214d61.mdl]],'chest',1)
    ac.wait(0,function()
        hero:play_animation('attack')
    end)
    point:effect{
        model = [[fdcd174428a0c65293cd271ce959629e.mdx]],
        angle = angle,
        time = 1.2,
        height = 90,
    }
    hero:set_facing(angle)
    ac.wait(1000,function()
        hero:remove_restriction '硬直'

        local mover = hero:launch_wave(self.missile_art,angle,1500,1500,2,90)
        mover.on_move = function(mover,point)
            local target = ac.selector('unit'):range(point,70):enemy(hero):first()
            if target then
                mover:remove()
                target:add_buff '捕捉'{time = 3}
            end
        end
    end)

end


local buff = ac.buff['捕捉']
buff.time = 3
buff.effect_data = {
    ['origin'] = [[Abilities\Spells\Orc\Ensnare\ensnareTarget.mdl]]
}
function buff:on_add()
    local hero = self.owner
    hero:add_restriction '定身'
    hero:notify('单位-禁用冲刺',hero)
    self:gc(function()
        hero:notify('单位-允许冲刺',hero)
        hero:remove_restriction '定身'
    end)
end